<template>
	<view class="container">
		<cu-custom bgColor="bg-top" :isBack="true">
			<block slot="content">站点列表</block>
		</cu-custom>
		<view class="address-list">
			<view class="a-address" v-for="(item,index) in list" :key="index">
				<navigator :url="'/pages/ucenter/siteSet/equipment/equipment-list?id=' + item.site_id" class="left-text">
					<view class="name-tel">
						{{item.name}}
					</view>
					<view class="address-box">
						{{item.site_type}}
					</view>
				</navigator>
				<navigator :url="'/pages/ucenter/siteSet/siteInfo?id=' + item.site_id" class="right-edit"></navigator>
			</view>
		</view>
		<!-- <view class="bottom-box">
			<view class="add-btn" @tap="addSite">新增站点</view>
		</view> -->

	</view>
</template>

<script>
	import Util from '@/utils/util.js';
	export default {
	    components: {
	        
	    },
		data() {
			return {
				list: [],
			}
		},
		onLoad() {
			//加载站点数据
			let userInfo = Util.getUserInfo();
			//加载站点
			Util.request('/monitor/groupSite/sites/user', {userId:userInfo.userId}, 'GET').then((res) => {
				this.list = []
				res.data.map(item => {
					this.list.push({name:item.siteName,site_id:item.siteId,site_type:'水系统'})
				})
			})
		},
		methods: {
			addSite() {
				console.log("tap add new Address");
			}
		}
	}
</script>

<style>
	.container {
		background-color: #F2f2f2;
	}

	.address-list {
		width: 100%;
		background-color: #fff;
		margin-top: 20upx;
		padding-bottom: 100upx;
	}

	.address-list .a-address {
		width: 720upx;
		margin-left: 30upx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30upx 0;
		border-bottom: 1upx solid #eee;
	}

	.a-address .left-text {
		width: 610upx;
		box-sizing: border-box;
		padding-left: 58upx;
	}

	.a-address .left-text.active {
		background: url() no-repeat left center;
		background-size: 28upx auto;
	}

	.a-address .left-text .name-tel {
		margin-bottom: 20upx;
	}

	.a-address .left-text .address-box {
		font-size: 24upx;
		color: #888888;
		line-height: 36upx;
	}

	.a-address .right-edit {
		width: 109upx;
		height: 100%;
		padding: 50upx 0 50upx 58upx;
		box-sizing: border-box;
		background: url() no-repeat 43upx center;
		background-size: 35upx auto;
	}
	
	.bottom-box {
		position: fixed;
		width: 100%;
		bottom: 0;
		font-size: 28upx;
		color: #000000;
		border-top: 1upx solid #eee;
		height: 100upx;
		line-height: 100upx;
		background: #fff url() no-repeat 705upx center;
		background-size: 15upx auto;
	}

	.bottom-box .add-btn {
		margin-left: 30upx;
		padding-left: 70upx;
		background: url() no-repeat left center;
		background-size: 40upx auto;
	}
</style>
